class Solution(object):
    def preorderTraversal(self, root):
        """
        :type root: TreeNode
        :rtype: List[int]
        """
        if root==None:
            return []
        li=[]
       
        li.append(root.val)
        li+=self.preorderTraversal(root.left)
       
        li+=self.preorderTraversal(root.right)
        return li